﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace SevenWizards1.CoreComponents
{
    class Camera
    {
        public Vector2 Position;
        float speed;

        public Camera(Vector2 position, float speed)
        {
            this.Position = position;
            this.speed = speed;
        }

        public Camera()
        {
            this.Position = Vector2.Zero;
            this.speed = 3.0f;
        }

        public float Speed
        {
            get { return speed; }
            set
            {
                speed = MathHelper.Clamp(value, 0.5f, 50);
            }
        }

        public void LockCamera()
        {
            Position.X = MathHelper.Clamp(
                Position.X,
                0,
                TileEngine.MapWidthInPixels - TileEngine.ScreenWidth);
            Position.Y = MathHelper.Clamp(
                Position.Y,
                0,
                TileEngine.MapHeightInPixels - TileEngine.ScreenHeight);
        }
    }
}
